<?php

namespace api\controller;

use common\controller\VerifyController;
use common\service\OCRService;
use think\Request;

class OCRController extends VerifyController
{
    /**
     * @var OCRService
     */
    private $ocrService;

    public function __construct()
    {
        parent::__construct();
        $this->ocrService = new OCRService();
    }

    /**
     * 解析图片
     * @param Request $request
     * @return \think\Response
     */
    public function parseImage(Request $request)
    {
        $param = $request->param();
        $res = $this->ocrService->parse($param);
        return json(success_response('', $res));
    }
}